﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICeFramework.Common.DataLayer;
using System.Data;

namespace ICeFramework.Business.DataLayer
{
    public interface IEntity
    {
        EntityRowErrorCollection GetErrors();
        EntityColumn[] Columns { get; }
        IEntityRow[] GetRows();
        EntityOrder DefaultOrder { get; set; }
        DataTable DataTable { get; }
        IEntityRow NewRow();
        string EntityName { get; }

        void Fill();
        void Fill(EntityFilter filter);
        void Fill(EntityFilter filter, IDbTransaction transaction);

        void Fill(EntityFilter filter, EntityOrder order);
        void Fill(EntityFilter filter, EntityOrder order, IDbTransaction transaction);

        void Fill(EntityFilter filter, int pageIndex, int pageSize, out long totalRowsCount);
        void Fill(EntityFilter filter, int pageIndex, int pageSize, out long totalRowsCount, IDbTransaction transaction);

        void Fill(EntityFilter filter, EntityOrder order, int pageIndex, int pageSize, out long totalRowsCount);
        void Fill(EntityFilter filter, EntityOrder order, int pageIndex, int pageSize, out long totalRowsCount, IDbTransaction transaction);

        void Fill(StoredProcedureDefinition spDefinition);
        void Fill(StoredProcedureDefinition spDefinition, IDbTransaction transaction);

        void Fill(StoredProcedureDefinition spDefinition, EntityOrder order);
        void Fill(StoredProcedureDefinition spDefinition, EntityOrder order, IDbTransaction transaction);

        long Count();
        long Count(EntityFilter filter);

        void Update();
        void Update(IDbTransaction transaction);
    }
}
